﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Net.Mail;
using System.Net;

namespace br.com.SistemaChamados.Util
{
    public class EmailUtils
    {

        public static void SendMail(string mailTo, string subject, string message)
        {
            MailMessage mailMessage = new MailMessage(ConfigurationManager.AppSettings["notificationMail"].ToString(),
                                                        mailTo,
                                                        subject,
                                                        message);
            mailMessage.IsBodyHtml = false;
            SmtpClient client = new SmtpClient();
            client.Host = ConfigurationManager.AppSettings["smtpServer"].ToString();
            //client.EnableSsl = true;
            NetworkCredential cred = new NetworkCredential(ConfigurationManager.AppSettings["notificationMail"].ToString(),
                                                           ConfigurationManager.AppSettings["notificationPwd"].ToString());
            client.UseDefaultCredentials = false;
            client.Credentials = cred;            
            client.Send(mailMessage);
        }

    }
}